const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const { clear } = require('console');

module.exports = {
    // mode: 'development',
    entry: './js/main.js',
    devtool: 'inline-source-map',
    devServer: {
        contentBase: './dist',
    },
    //   production development
    mode: 'production',
    // plugins: [
    //     new HtmlWebpackPlugin({
    //         title: '管理输出',
    //         //html模板
    //         template: 'index.html'
    //     }),
    // ],
    module: {
        rules: [
            {
                test: /\.css$/i,
                use: ['style-loader', 'css-loader'],
            },
            {
                test: /\.(png|svg|jpg|jpeg|gif)$/i,
                type: 'asset/resource',
            },
            {
                test: /\.(woff|woff2|eot|ttf|otf)$/i,
                use: 'url-loader'
            },
        ],
    },
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, 'dist'),
        clean: true,
    },
};